package jp.selfportrait.twonkyscrobbler4j;

import java.util.GregorianCalendar;
import java.util.HashMap;

/**
 *
 * @author kazuho
 */
public class Music {

    HashMap<String, Integer> month;

    public Music() {
        month = new HashMap();
        month.put("Jan", 1);
        month.put("Feb", 2);
        month.put("Mar", 3);
        month.put("Apl", 4);
        month.put("May", 5);
        month.put("Jun", 6);
        month.put("Jul", 7);
        month.put("Aug", 8);
        month.put("Sep", 9);
        month.put("Oct", 10);
        month.put("Nov", 11);
        month.put("Dec", 12);
    }
    protected String title;

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }
    protected String artist;

    public String getArtist() {
        return artist;
    }

    public void setArtist(String artist) {
        this.artist = artist;
    }
    protected String album;

    public String getAlbum() {
        return album;
    }

    public void setAlbum(String album) {
        this.album = album;
    }
    protected GregorianCalendar dateTime;

    public GregorianCalendar getDateTime() {
        return dateTime;
    }

    public void setDateTime(GregorianCalendar dateTime) {
        this.dateTime = dateTime;
    }

    public void setDateTimeString(String dateString) {
        String item[] = dateString.split(" ");
        int thisYear = Integer.valueOf(item[3]);
        int thisMonth = month.get(item[2]);
        int thisDayOfMonth = Integer.valueOf(item[1]);
        String time[] = item[4].split(":");
        int thisHourOfDay = Integer.valueOf(time[0]);
        int thisMinute = Integer.valueOf(time[1]);
        int thisSecond = Integer.valueOf(time[2]);
        dateTime = new GregorianCalendar(thisYear, thisMonth,
                thisDayOfMonth, thisHourOfDay, thisMinute, thisSecond);
    }
    protected int duration;

    public int getDuration() {
        return duration;
    }

    public void setDuration(int duration) {
        this.duration = duration;
    }
}
